@import "../style/globals.scss";

.tsconfig {
  margin-bottom: 6rem;
  // Drastically reduce the padding and margins to make it fit phones
  &.raised {
    @media (max-width: $screen-xs) {
      margin: 0;
      padding: 2rem;

      #full-option-list {
        padding: 10px;
      }

      .indent {
        padding: 1rem;
      }
    }
  }

  // The quick jump section

  &.button {
    margin-bottom: 2rem;
    > a {
      display: block;
    }
    svg {
      margin-top: 0.8rem;
      margin-right: 0.3rem;
      path {
        stroke: var(--text-color);
      }
    }
  }
  &.button.closed {
    svg {
      transform: rotate(270deg);
    }
  }
  &.button.open {
    a {
      text-decoration: none;
      color: var(--text-color);
    }
  }

  .tsconfig-quick-nav {
    &.grouped {
      border-left: 1px solid var(--text-color);
      margin-bottom: 3rem;
    }
    margin-left: -1rem;
    padding-left: 1rem;

    h4 {
      font-weight: normal;
      margin-bottom: 0.1rem;
      a {
        color: var(--text-color);
      }
    }
    .tsconfig-quick-nav-category {
      display: flex;
      align-items: flex-start;

      @media (max-width: $screen-md) {
        flex-direction: column;
      }
      h5 {
        width: 160px;
        flex: 0 0 auto;
      }
      ol {
        max-width: 100%;
        flex: 1 1 auto;
      }
      li {
        list-style: none;
        display: inline-block;
        margin-left: 8px;
        a {
          color: var(--text-color);
          text-decoration: none;
          &:hover {
            text-decoration: underline;
          }
        }
        span {
          opacity: 0.8;
        }
      }
    }
  }

  article {
    width: 100%;
  }

  // Handles hash links with a sticky header
  a[id]::before {
    display: block;
    content: "";
    margin-top: -80px;
    height: 80px;
    visibility: hidden;
    scroll-margin-top: 121px;
  }

  .indent {
    padding: 2rem;
  }

  div#full-option-list {
    display: flex;
    flex-flow: row wrap;

    div.tsconfig-nav-top {
      flex: auto;
      margin: 0 8px 8px 0; /* Some gutter */
      width: 30%;

      @media (max-width: $screen-xs) {
        width: 46%;
        h5 {
          overflow-x: hidden;
        }
      }

      h5 a {
        font-size: 2rem;
        font-weight: 400;
        text-decoration: none;
        color: var(--text-color);
      }

      ul {
        margin: 0;
        padding: 0;
      }
      li {
        font-family: $font-code;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        a {
          color: var(--text-color);
        }
      }
    }
  }

  nav {
    position: sticky;
    top: 0px;
    z-index: 99999;
    background-color: var(--raised-background-color);

    ul {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      margin: 0;
    }

    @media (max-width: $screen-sm) {
      position: static;
      ul {
        flex-wrap: wrap;
      }

      li {
        min-width: 120px;
      }
    }

    border-bottom: 1px solid lightgray;
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding-top: 4px;
    padding-bottom: 10px;

    a {
      text-decoration: none;

      &.current {
        border-bottom: 1px solid $ts-main-blue-color;
      }
    }

    li {
      display: block;
      margin: 6px;
    }
  }

  .category {
    margin-top: 80px;
    margin-bottom: 40px;

    > h2 {
      > a {
        &:focus {
          outline: none;
          background-color: black;
          color: white;
        }
      }
    }
  }

  .compiler-option {
    margin-bottom: 80px;

    > h3 {
      margin-bottom: 0;
      overflow-x: hidden;
      offset-anchor: -30px;

      @media (max-width: $screen-sm) {
        display: block;
        overflow-y: hidden;
      }

      > a {
        scroll-margin-top: 65px;

        &:focus {
          outline: none;
          background-color: black;
          color: white;
        }
      }
    }

    .compiler-content {
      display: flex;

      .markdown {
        flex-shrink: 1;
        width: calc(100% - 250px);
        border-right: 1px solid gray;
        padding-right: 20px;
        word-wrap: break-word;

        @media (max-width: $screen-xs) {
          border-right: none;
          padding-right: 0;
        }
      }

      ul.compiler-option-md {
        width: 220px;
        max-width: 220px;
        min-width: 200px;
        overflow-x: hidden;
        margin-left: 20px;
        padding: 0;
        float: right;
        span {
          width: 100px;
          display: block;
          font-weight: 600;
        }
        li {
          list-style: none;
          margin-bottom: 12px;

          ul {
            padding: 0;
            margin-bottom: 18px;
          }
          li {
            margin: 0;
            margin-bottom: 12px;
          }
        }
        tr {
          padding: 10px 0;
        }
        li > p {
          margin: 0;
          display: inline-block;
        }
      }

      @media (max-width: $screen-sm) {
        flex-direction: column;

        .markdown {
          width: 100%;
        }

        ul.compiler-option-md {
          width: 100%;
          margin-left: 0;
        }
      }
    }
  }
}
